package com.kma.summer2012.client.services.catalogOfWorks;


import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.kma.summer2012.client.ExceptionHandling.CrumbsRPCServiceException;
import com.kma.summer2012.shared.model.UICrumbsWorkItem;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

@RemoteServiceRelativePath("CrumbsCatalogOfWorksService")
public interface CrumbsCatalogOfWorksService extends RemoteService {

    public void saveWorkItem(UICrumbsWorkItem work) throws CrumbsRPCServiceException;

    public Set<UICrumbsWorkItem> getAllWorks() throws CrumbsRPCServiceException;

    public UICrumbsWorkItem getWorkById(int id) throws Exception;

    public List<String> getAllCategories() throws CrumbsRPCServiceException;

    public boolean checkForSubcategory(int subCategoryId, UICrumbsWorkItem element) throws CrumbsRPCServiceException;

    boolean deleteAllWorks(ArrayList<Integer> idList) throws CrumbsRPCServiceException;

    public static class App {
        private static final CrumbsCatalogOfWorksServiceAsync ourInstance = (CrumbsCatalogOfWorksServiceAsync) GWT.create(CrumbsCatalogOfWorksService.class);

        public static CrumbsCatalogOfWorksServiceAsync getInstance() {
            return ourInstance;
        }
    }
}
